]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Revert showing notifications in the locked screen
authorGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 27 Aug 2012 12:42:22 +0000 (14:42 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 13 Sep 2012 22:06:30 +0000 (00:06 +0200)
As PAM messages are now shown below the password entry, there is no
need for this complexity, and we can just hide all notifications.
Also, this avoids the ambiguity between notification.showWhenLocked and
source.showInLockScreen, which have very different effects.

https://bugzilla.gnome.org/show_bug.cgi?id=683369

js/ui/main.js
js/ui/messageTray.js
js/ui/overview.js

index 0fbd7310cee87623728028da0bb19eed7511a622..40b87d3c075fab7bf0d6665e141ddbe65b91d5c8 100644 (file)
@@ -433,7 +433,6 @@ function notify(msg, details) {
     messageTray.add(source);
     let notification = new MessageTray.Notification(source, msg, details);
     notification.setTransient(true);
-    notification.setShowWhenLocked(true);
     source.notify(notification);
 }
 
index f5fdeb447c7218948a7c5f75b8c1254f0036bc06..c563b8fc5c4c0d7753502fd06cf7e0585eb1117f 100644 (file)
@@ -319,7 +319,6 @@ const Notification = new Lang.Class({
         this.isTransient = false;
         this.expanded = false;
         this.focused = false;
-        this.showWhenLocked = false;
         this.acknowledged = false;
         this._destroyed = false;
         this._useActionIcons = false;
@@ -712,14 +711,6 @@ const Notification = new Lang.Class({
         this.isTransient = isTransient;
     },
 
-    setShowWhenLocked: function(show) {
-        if (show && !this.isTransient) {
-            throw new Error('ShowWhenLocked can only be set on a transient notification');
-        }
-
-        this.showWhenLocked = show;
-    },
-
     setUseActionIcons: function(useIcons) {
         this._useActionIcons = useIcons;
     },
@@ -1904,14 +1895,10 @@ const MessageTray = new Lang.Class({
     // at the present time.
     _updateState: function() {
         // Notifications
-        let notificationQueue = this._notificationQueue.filter(Lang.bind(this, function(notification) {
-            return notification.showWhenLocked || Main.sessionMode.hasNotifications;
-        }));
+        let notificationQueue = this._notificationQueue;
         let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL;
-        // notificationsLimited is false when the screen is locked, because they go through
-        // different filtering, and we want to show non urgent messages at times
-        let notificationsLimited = (this._busy || this._inFullscreen) && Main.sessionMode.hasNotifications;
-        let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent);
+        let notificationsLimited = this._busy || this._inFullscreen;
+        let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent) && Main.sessionMode.hasNotifications;
         let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
         let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
         let notificationExpanded = this._notification && this._notification.expanded;
@@ -1921,15 +1908,13 @@ const MessageTray = new Lang.Class({
                                   !this._pointerInTray &&
                                   !this._locked &&
                                   !(this._pointerInKeyboard && notificationExpanded);
-        let notificationLockedOut = !Main.sessionMode.hasNotifications && (this._notification && !this._notification.showWhenLocked);
-        // TODO: how to deal with locked out notiifcations if want to keep showing notifications?!
+        let notificationLockedOut = !Main.sessionMode.hasNotifications && this._notification;
         let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed;
         let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN;
 
         if (this._notificationState == State.HIDDEN) {
             if (canShowNotification) {
-                this._showNotification(nextNotification);
-                this._notificationQueue.splice(this._notificationQueue.indexOf(nextNotification), 1);
+                this._showNotification();
             }
         } else if (this._notificationState == State.SHOWN) {
             if (notificationMustClose)
@@ -2123,8 +2108,8 @@ const MessageTray = new Lang.Class({
         this._updateState();
     },
 
-    _showNotification: function(notification) {
-        this._notification = notification;
+    _showNotification: function() {
+        this._notification = this._notificationQueue.shift();
         this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
         this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME,
                                                               Lang.bind(this, this._onIdleMonitorWatch));
index eab79ff03ad7fff2877e4497e3a36519a97e8292..ddf2780974661c599facc3f35eac3649bc400876 100644 (file)
@@ -71,7 +71,6 @@ const ShellInfo = new Lang.Class({
         if (this._source.notifications.length == 0) {
             notification = new MessageTray.Notification(this._source, text, null);
             notification.setTransient(true);
-            notification.setShowWhenLocked(true);
         } else {
             notification = this._source.notifications[0];
             notification.update(text, null, { clear: true });